<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Overseer Framework</title>
<style type="text/css">

/* ------- [BASE] GLOBAL------- */

* { margin: 0px; padding: 0px; }

body {
	font-family: 'Arial', sans-serif;
	font-size: 10pt;
	font-weight: normal;
	line-height: 14pt;
}

li {
	list-style: none;
}

pre, code {
	font-family: 'Monaco', monospace;
	font-size: 7pt;
}

a, code {
	white-space: nowrap;
}


/* ------- [BASE] CONTAINER ------- */

#container {
	min-width: 780px;
}


/* ------- [BASE] HEADER ------- */

#header {
	padding: 20px 20px 25px;
}

#header h1 {
	padding: 0px 0px 5px 0px;
	font-family: 'Arial', sans-serif;
	font-size: 18pt;
	font-weight: normal;
	line-height: 20pt;
}

#header a {
	color: #EEE;
}

#header div.download {
	position: absolute;
	top: 25px;
	right: 20px;
	white-space: nowrap;
}


/* ------- [BASE] SIDEBAR ------- */

#sidebar {
	float: left;
	width: 200px;
	padding: 10px;
}

#sidebar ul {
	margin: 0px 0px 20px;
}

#sidebar ul li.header {
	margin: 0px 0px 10px;
}

#sidebar ul li ul {
	margin: 0px 0px 0px 5px;
}

#sidebar ul li ul li a:before {
	float: left;
	padding: 0px 5px 0px 0px;
	content: ' - ';
}

#sidebar ul li ul li a {
	display: block;
	padding: 2px 5px;
	font-size: 8pt;
	text-decoration: none;
}


/* ------- [BASE] CONTENT ------- */

#content {
	margin: 0px 10px 0px 210px;
	padding: 15px 20px;
	position: relative;
	top: -12px;
}

#content h1 {
	margin: 20px 0px 20px;
	font-size: 16pt;
	font-weight: normal;
	line-height: 20pt;
}

#content h1 a, #content dl dt a {
	position: absolute;
	right: 20px;
	font-size: 8pt;
}

#content dl dt {
	padding: 0px 0px 5px 0px;
}

#content p {
	margin: 5px 0px 10px;
}

#content dt {
	margin: 25px 0px 10px 0px;
	font-size: 12pt;
}

#content dd.dh {
	margin: 15px 0px 0px 0px;
	font-weight: bold;
}

#content dd.alert {
	margin: 10px 0px 15px 0px;
	padding: 3px 8px;
}

#content dd.alert:before {
	font-weight: bold;
	content: 'Alert! ';
}

#content dd.notice {
	margin: 10px 0px 15px 0px;
	padding: 3px 8px;
}

#content dd.notice:before {
	font-weight: bold;
	content: 'Notice: ';
}

#content dd.attr {
	margin: 5px 0px 0px 10px;
}
#content pre {
	margin: 5px 0px 5px;
	padding: 3px 10px;
}

#content pre strong {
	font-size: 8pt;
}

#content a:hover {
	text-decoration: none;
}

#content div.notice {
	margin: 0px 0px 15px;
	padding: 5px 10px;
}


/* ------- [BASE] FOOTER------- */

#footer {
	margin: 0px 0px 10px 210px;
	text-align: center;
}

#footer a:hover {
	text-decoration: none;
}


/* ------- [BASE] PRINT ------- */

@media print {

	* {
		color: #333 !important;
		text-shadow: none !important;
		border: 0px none !important;
		background: transparent !important;
	}

	#sidebar { display: none; }

	#content, #footer { margin: 0px; }

}


/* ------- [COLOR] GLOBAL------- */

body {
	color: #222;
	background: #2A3D41;
}

a {
	color: #222;
}


/* ------- [COLOR] HEADER ------- */

#header {
	color: #FFF;
	text-shadow: 1px 1px #222;
	border-top: 5px solid #203034;
	background: #26393D;
}

/* ------- [COLOR] SIDEBAR ------- */

#sidebar {
	color: #DDD;
	text-shadow: 1px 1px #222;
	border-top: 2px solid #203034;
	border-bottom: 0px solid #203034;
	background: #2A3D41;
}

#sidebar ul li ul {
	border-top: 1px solid #364e3d;
}

#sidebar ul li ul li a {
	color: #CCC;
	border-bottom: 1px solid #364e3d;
}

#sidebar ul li ul li a:hover {
	color: #FFF;
	background: #203034;
}


/* ------- [COLOR] CONTENT ------- */

#content {
	border: 6px solid #203034;
	background: #FFF;
}

#content h1 {
	text-shadow: 2px 2px #DDD;
	border-bottom: 1px solid #999;
}


#content dl dt {
	border-bottom: 1px solid #AAA;
}

#content dd.alert {
	border: 2px solid #EB5959;
	background: #F3AAAA;
}

#content dd.notice, #content div.notice {
	border: 2px solid #E9E943;
	background: #F2F2AA;
}

#content dd.attr {
	color: #555;
}

#content dd.attr strong {
	color: #333;
}

#content pre {
	background: #C0E4C2;
}

#content span.optional {
	color: #666;
}


/* ------- [COLOR] FOOTER------- */

#footer, #footer a {
	color: #FFF;
}


</style>
</head>

<body>

<div id="container">

<div id="header">

<h1>Overseer Framework</h1>

<div class="download">&darr; <a href="http://overseerframework.googlecode.com/svn/trunk/framework/framework.php">Download Latest Version</a></div>

</div>

<div id="sidebar">

<ul>
<li class="header">Templates</li>

<li>

<ul>
<li><a href="#template_site_level">Site Level</a></li>
<li><a href="#template_element">Element</a></li>
</ul>

</li>
</ul>

<ul>
<li class="header">Constants</li>

<li>

<ul>
<li><a href="#const_error_log">error_log</a></li>
<li><a href="#const_error_reporting">error_reporting</a></li>
<li><a href="#const_int_microtime">int_microtime</a></li>
<li><a href="#const_lnbr">lnbr</a></li>
<li><a href="#const_maxview">maxview</a></li>
<li><a href="#const_page">page</a></li>
<li><a href="#const_script">script</a></li>
<li><a href="#const_url">url</a></li>
</ul>

</li>
</ul>

<ul>
<li class="header">Functions</li>

<li>

<ul>
<li><a href="#func_array_clean">array_clean()</a></li>
<li><a href="#func_array_move">array_move()</a></li>
<li><a href="#func_array_sort">array_sort()</a></li>
<li><a href="#func_array_walk_recursive">array_walk_recursive()</a></li>
<li><a href="#func_check_referer">check_referer()</a></li>
<li><a href="#func_dir_get_contents">dir_get_contents()</a></li>
<li><a href="#func_endtime">endtime()</a></li>
<li><a href="#func_error">error()</a></li>
<li><a href="#func_fetch_remote_file">fetch_remote_file()</a></li>
<li><a href="#func_field_type">field_type()</a></li>
<li><a href="#func_file_put_contents">file_put_contents()</a></li>
<li><a href="#func_is_date">is_date()</a></li>
<li><a href="#func_is_email">is_email()</a></li>
<li><a href="#func_is_empty">is_empty()</a></li>
<li><a href="#func_is_number">is_number()</a></li>
<li><a href="#func_is_simple">is_simple()</a></li>
<li><a href="#func_is_simple_alpha">is_simple_alpha()</a></li>
<li><a href="#func_is_simple_number">is_simple_number()</a></li>
<li><a href="#func_is_web_address">is_web_address()</a></li>
<li><a href="#func_mysql_fetch_results">mysql_fetch_results()</a></li>
<li><a href="#func_path_info">path_info()</a></li>
<li><a href="#func_primary_key">primary_key()</a></li>
<li><a href="#func_print_array">print_array()</a></li>
<li><a href="#func_sanitize_data">sanitize_data()</a></li>
<li><a href="#func_set_location">set_location()</a></li>
<li><a href="#func_timeago">timeago()</a></li>
<li><a href="#func_url_query">url_query()</a></li>

</ul>

</li>
</ul>

<ul>
<li class="header">Classes</li>

<li>

<ul>
<li><a href="#class_database_resource">$Database-&gt;resource</a></li>
<li><a href="#class_database_results">$Database-&gt;results</a></li>
<li><a href="#class_database_databaselist">$Database-&gt;DatabaseList();</a></li>
<li><a href="#class_database_tablelist">$Database-&gt;TableList();</a></li>
<li><a href="#class_database_table">$Database-&gt;Table();</a></li>
<li><a href="#class_database_process">$Database-&gt;Process();</a></li>
<li><a href="#class_db_resource">$DB-&gt;resource</a></li>
<li><a href="#class_db_results">$DB-&gt;results</a></li>
<li><a href="#class_db_instances">$DB-&gt;instances</a></li>
<li><a href="#class_db_connect">$DB-&gt;Connect();</a></li>
<li><a href="#class_db_query">$DB-&gt;Query();</a></li>
<li><a href="#class_db_close">$DB-&gt;Close();</a></li>
<li><a href="#class_gfx_resize">$GFX-&gt;Resize();</a></li>
<li><a href="#class_template_tools">$Template-&gt;tools</a></li>
<li><a href="#class_template_parse">$Template-&gt;Parse();</a></li>
<li><a href="#class_template_render">$Template-&gt;Render();</a></li>
<li><a href="#class_template_generate">$Template-&gt;Generate();</a></li>
<li><a href="#class_template_pagination">$Template-&gt;Pagination();</a></li>
<li><a href="#class_template_form">$Template-&gt;Form();</a></li>
</ul>

</li>
</ul>

</div>

<div id="content">

<div class="notice">This framework is in the early stages of it's first beta. If you come across any issues in the documentation or the framework, please make note of it via the <a href="http://groups.google.com/group/overseer-cms/">Google Group</a>.</div>

<h1>Templates <a href="#">&uarr; top</a></h1>

<p>The template system built into the framework utilizes PHP's output buffer functionality to capture and parse the content of a page, replace certain variables in a separate template file with that content, then render the results. This functionality is optional and will only be available if a template file is defined before the framework is called.</p>

<strong>Example:</strong>

<pre>$ob_template = file_get_contents('templates/main.tpl');</pre>


<dl>

<dt id="template_site_level"><strong>Site Level</strong> <a href="#">&uarr; top</a></dt>

<dd><p>The site level template is used to easily build sites with a global template. This type of template file requires the variables %TITLE% and %BODY%. (Optional variable is %HEAD%.)</p></dd>

<dd class="dh">Example:</dd>

<dd><pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
&lt;head&gt;
&lt;title&gt;%TITLE%&lt;/title&gt;
%HEAD%
&lt;/head&gt;

&lt;body&gt;

&lt;h1&gt;%TITLE%&lt;/h1&gt;

%BODY%

&lt;/body&gt;
&lt;/html&gt;</pre></dd>

<dd><p>The %TITLE% and %BODY% variables will both be replaced by the contents of their similarly named HTML tags; <code>&lt;title&gt;</code> and <code>&lt;body&gt;</code>. Likewise, the contents of the <code>&lt;head&gt;</code> tag (minus the <code>&lt;title&gt;</code> tag) will replace the %HEAD% variable.</p></dd>

<dd class="dh">Example:</dd>

<dd><pre>&lt;?php

$ob_template = file_get_contents('templates/main.tpl');
require_once('scripts/framework.php');

?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Lorem ipsum&lt;/title&gt;
&lt;link type="text/css" rel="stylesheet" href="style.css" /&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam sed nibh quis
enim pellentesque porttitor. Aenean vel turpis. Nam blandit velit ut est. Integer
non sem a neque mollis aliquet. Nam magna. Nullam interdum, augue ut semper
dignissim, massa massa adipiscing nulla, volutpat rutrum nisl lacus ac erat.&lt;/p&gt;

&lt;/body&gt;
&lt;/html&gt;</pre></dd>

<dt id="template_element"><strong>Element</strong> <a href="#">&uarr; top</a></dt>

<dd><p>Element templates are for displaying multiple, similarly structured elements of data with repeating HTML in conjunction with <a href="#class_template_parse"><code>$Template-&gt;Parse();</code></a> and <a href="#class_template_render"><code>$Template-&gt;Render();</code></a>. The below example shows a template that will render the contents of <code>&lt;!--{header:start|end}--&gt;</code> first, followed by either <code>&lt;!--{data:start|end}--&gt;</code> or <code>&lt;!--{nodata:start|end}--&gt;</code> and ending with <code>&lt;!--{footer:start|end}--&gt;</code>.</p></dd>

<dd class="dh">Example:</dd>

<dd><pre>&lt;!--{header:start}--&gt;

&lt;div&gt;

&lt;!--{header:end}--&gt;


&lt;!--{data:start}--&gt;

&lt;div class="bookmark"&gt;

&lt;h3&gt;&lt;a href="%URL%"&gt;%DESCRIPTION%&lt;/a&gt;&lt;/h3&gt;
&lt;span class="dim"&gt;to %TAG%&lt;/span&gt;

&lt;/div&gt;

&lt;!--{data:end}--&gt;

&lt;!--{nodata:start}--&gt;

&lt;p&gt;No bookmarks.&lt;/p&gt;

&lt;!--{nodata:end}--&gt;


&lt;!--{footer:start}--&gt;

&lt;/div&gt;

&lt;!--{footer:end}--&gt;</pre></dd>


<dd><p>The data passed along with this template defines wether or not the <code>&lt;!--{data:start|end}--&gt;</code> or <code>&lt;!--{nodata:start|end}--&gt;</code> section of the template is used. Below is an example of data that can be passed along with element templates.</p></dd>

<dd class="dh">Example:</dd>

<dd><pre>$data = array();

$data[] = array('url'=>'http://www.latherrinserepeat.org/',
		'description'=>'Lather Rinse Repeat', 'tag'=>'blog');
$data[] = array('url'=>'http://www.jemjabella.co.uk/',
		'description'=>'Jemjabella.co.uk', 'tag'=>'blog');
$data[] = array('url'=>'http://www.justinshattuck.com/',
		'description'=>'Justin Shattuck', 'tag'=>'blog');
$data[] = array('url'=>'http://chunkysoup.net/',
		'description'=>'ChunkySoup.net', 'tag'=>'blog');
$data[] = array('url'=>'http://ejohn.org/',
		'description'=>'John Resig', 'tag'=>'blog');

echo $Template-&gt;Render('template.tpl', $data);</pre></dd>

<dd><p>Based on the number of arrays within $data (above), the contents of <code>&lt;!--{data:start|end}--&gt;</code> will be repeated four separate times, each time replacing the variables with the array's keys and values. If the array passed was empty, then the contents of <code>&lt;!--{data:start|end}--&gt;</code> will be returned. If you require that certain variables be replaced within the <code>&lt;!--{header:start|end}--&gt;</code> or <code>&lt;!--{footer:start|end}--&gt;</code> section of the template, setup the data array like the below example.</p></dd>

<dd class="dh">Example:</dd>

<dd><pre>$data = array();

$data['header'][] = array('var'=>'All your items (4)');

$data['data'][] = array('url'=>'http://www.latherrinserepeat.org/',
			'description'=>'Lather Rinse Repeat', 'tag'=>'blog');
$data['data'][] = array('url'=>'http://www.jemjabella.co.uk/',
			'description'=>'Jemjabella.co.uk', 'tag'=>'blog');
$data['data'][] = array('url'=>'http://www.justinshattuck.com/',
			'description'=>'Justin Shattuck', 'tag'=>'blog');
$data['data'][] = array('url'=>'http://chunkysoup.net/',
			'description'=>'ChunkySoup.net', 'tag'=>'blog');
$data['data'][] = array('url'=>'http://ejohn.org/',
			'description'=>'John Resig', 'tag'=>'blog');

$data['footer'][] = array('var'=>'All your items (4)');

echo $Template-&gt;Render('template.tpl', $data);</pre></dd>

</dl>


<h1>Constants <a href="#">&uarr; top</a></h1>

<p>When setting preset values for constants, define them before calling the framework. If the constant already exists on framework load, the preexisting constant will take precedence over the default.</p>

<dl>


<dt id="const_error_log" class="constant"><strong>error_log</strong> <a href="#">&uarr; top</a></dt>
<dd><p>The default value of <code>error_log</code> is <em>false</em>. This should remain false if you don't want errors to be logged. Replacing <em>false</em> with a file name will send all errors to that file.</p></dd>

<dd class="notice">It is good programming practice to check to see if a constant already exists.</dd>

<dd class="dh">Example:</dd>
<dd><pre>if (!defined('error_log')) { define('error_log', 'errors.log'); }</pre></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo constant(error_log);</pre></dd>


<dt id="const_error_reporting" class="constant"><strong>error_reporting</strong> <a href="#">&uarr; top</a></dt>
<dd><p>The default value of <code>error_reporting</code> is <em>false</em>. This should remain false if you don't want errors to display.</p></dd>

<dd class="notice">It is good programming practice to check to see if a constant already exists.</dd>

<dd class="dh">Example:</dd>
<dd><pre>if (!defined('error_reporting')) { define('error_reporting', false); }</pre></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo constant('error_reporting');</pre></dd>


<dt id="const_int_microtime" class="constant"><strong>int_microtime</strong> <a href="#">&uarr; top</a></dt>
<dd><p>The default value of <code>int_microtime</code> is the Unix timestamp (with microseconds) of the time your application starts (used with <a href="#func_endtime"><code>endtime()</code></a>).</p></dd>

<dd class="alert">The preset value of this constant should not be changed!</dd>

<dd class="dh">Example:</dd>
<dd><pre>echo constant('int_microtime');</pre></dd>


<dt id="const_lnbr" class="constant"><strong>lnbr</strong> <a href="#">&uarr; top</a></dt>
<dd><p>The default value of <code>lnbr</code> is <code>PHP_EOL</code>. This built in PHP constant reflects the new-line character of the server.</p></dd>

<dd class="notice">It is good programming practice to check to see if a constant already exists.</dd>

<dd class="notice">The other possible values of this constant \n, \r, or \r\n must be surrounded by double quotes.</dd>

<dd class="dh">Example:</dd>
<dd><pre>if (!defined('lnbr')) { define('lnbr', "\n"); }</pre></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo constant('lnbr');</pre></dd>


<dt id="const_maxview" class="constant"><strong>maxview</strong> <a href="#">&uarr; top</a></dt>
<dd><p>The default value of <code>maxview</code> is <em>10</em>. This should be changed to reflect the default number of viewable items in your application (used with <a href="#class_database_table"><code>$Database-&gt;Table()</code></a>).</p></dd>

<dd class="notice">It is good programming practice to check to see if a constant already exists.</dd>

<dd class="dh">Example:</dd>
<dd><pre>if (!defined('maxview')) { define('maxview', 10); }</pre></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo constant('maxview');</pre></dd>


<dt id="const_page" class="constant"><strong>page</strong> <a href="#">&uarr; top</a></dt>
<dd><p>The default value of <code>page</code> is the value of <code>$_SERVER['PHP_SELF']</code>.</p></dd>

<dd class="alert">The preset value of this constant should not be changed!</dd>

<dd class="dh">Example:</dd>
<dd><pre>echo constant('page');</pre></dd>


<dt id="const_script" class="constant"><strong>script</strong> <a href="#">&uarr; top</a></dt>
<dd><p>The default value of <code>script</code> is the value of <code>$_SERVER['SCRIPT_NAME']</code>.</p></dd>

<dd class="alert">The preset value of this constant should not be changed!</dd>

<dd class="dh">Example:</dd>
<dd><pre>echo constant('script');</pre></dd>


<dt id="const_url" class="constant"><strong>url</strong> <a href="#">&uarr; top</a></dt>
<dd><p>The default value of <code>url</code> is the address of the page your are currently on.</p></dd>

<dd class="alert">The preset value of this constant should not be changed!</dd>

<dd class="dh">Example:</dd>
<dd><pre>echo constant('url');</pre></dd>


</dl>

<h1>Functions <a href="#">&uarr; top</a></h1>

<p>The majority of the functions included in this framework are to allow for use in both PHP5 and PHP4 as some functions were not available until specific versions of PHP5.</p>

<dl>


<dt id="func_array_clean" class="function"><strong>array_clean</strong>(<em>array $array</em> <span class="optional">[, string $method]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Cleans values of an array (recursively) by either trimming values or clearing empty </p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$array</strong> - Array to be processed.<br />
<strong>$method</strong> - Default value is <em>null</em>. Alternate value is <em>'empty'</em>.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$array1 = array('value1', 'value1', 'value2', ' value2 ', '');
<a href="#func_print_array">print_array</a>(array_clean($array1));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => value1
    [1] => value1
    [2] => value2
    [3] => value2
    [4] =>
)</pre></dd>

<dd class="dh">Example:</dd>
<dd><pre>$array1 = array('value1', 'value1', 'value2', ' value2 ', '');
<a href="#func_print_array">print_array</a>(array_clean($array1, 'empty'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => value1
    [1] => value1
    [2] => value2
    [3] => value2
)</pre></dd>


<dt id="func_array_move" class="function"><strong>array_move</strong>(<em>array $array, integer $key, integer $offset</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Used to easily move values of an array.</p></dd>

<dd class="alert">Only variables can be passed by reference for the first attribute.</dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$array</strong> - Array to be modified.<br />
<strong>$key</strong> - The key of the array value you want to move.<br />
<strong>$offset</strong> - The position you want to move the array value to.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$array = array('value1', 'value2', 'value3', 'value4');
<a href="#func_print_array">print_array</a>(array_move($array, 1, 2));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => value1
    [1] => value3
    [2] => value2
    [3] => value4
)</pre></dd>


<dt id="func_array_sort" class="function"><strong>array_sort</strong>(<em>array $array <span class="optional">[, int $flag]</span></em>); <a href="#">&uarr; top</a></dt>
<dd><p>Sorts and returns an array.</p></dd>

<dd class="alert">Only variables can be passed by reference for the first attribute.</dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$array</strong> - Array to be modified.<br />
<strong>$flag</strong> - Default value is <em>null</em>. Alternate values are <code>SORT_REGULAR</code>,  <code>SORT_NUMERIC</code>,  <code>SORT_STRING</code>, and  <code>SORT_LOCALE_STRING</code>. <a href="http://us2.php.net/sort">More info on function <code>sort()</code></a><br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$array = array('value2', 'value3', 'value1', 'value4');
<a href="#func_print_array">print_array</a>(array_sort($array));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => value1
    [1] => value3
    [2] => value2
    [3] => value4
)</pre></dd>


<dt id="func_array_walk_recursive" class="function"><strong>array_walk_recursive</strong>(<em>array $array, function $func</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Runs a function on each value of the array recursively.</p></dd>

<dd class="alert">Only variables can be passed by reference for the first attribute.</dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$array</strong> - Array to be modified.<br />
<strong>$func</strong> - Function each value of the array will be passed through.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>function custom($key, $value) { return trim($value); }
$array = array(' username', 'password');
<a href="#func_print_array">print_array</a>(array_walk_recursive($array, 'custom'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => username
    [1] => password
)</pre></dd>


<dt id="func_check_referer" class="function"><strong>check_referer</strong>(); <a href="#">&uarr; top</a></dt>
<dd><p>Checks the current URL against the HTTP referer.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>if (!check_referer() &amp;&amp; count($_POST)) { echo 'The HTTP referer is invalid.'; }</pre></dd>


<dt id="func_dir_get_contents" class="function"><strong>dir_get_contents</strong>(<span class="optional">[string $dir, string $filter, constant $sort]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Returns a multi-dimensional array of all the files and directories recursively in a specific directory.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$dir</strong> - Directory to search.<br />
<strong>$filter</strong> - Use a regular expression to filter the results of the search.<br />
<strong>$sort</strong> - Direction to sort the file types. (<code>SORT_ASC</code> or <code>SORT_DESC</code>)
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$photos = dir_get_contents('photos/', '/(\/$|\.(jpg|jpeg|gif|png)$)/', SORT_ASC);</pre></dd>


<dt id="func_endtime" class="function"><strong>endtime</strong>(); <a href="#">&uarr; top</a></dt>
<dd><p>Outputs time elapsed since script started.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo 'Script took ' . round(endtime(), 3) . ' second(s) to run.';</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Script took 0.016 second(s) to run.</pre></dd>


<dt id="func_error" class="function"><strong>error</strong>(<em>string $text</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Used by functions to output or log errors (based on the <a href="#const_error_reporting"><code>error_reporting</code></a> and <a href="#const_error_log"><code>error_log</code></a> constants).</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$text</strong> - Text to send to the error buffer.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>error('Error: This is a sample error');</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>&lt;p&gt;&lt;b&gt;Error:&lt;/b&gt; This is a sample error&lt;/p&gt;</pre></dd>


<dt id="func_fetch_remote_file" class="function"><strong>fetch_remote_file</strong>(<em>string $file</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Retrieves the contents of a remote file. Alternative to using <code>file_get_contents()</code> when <a href="http://us3.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen">allow_url_fopen</a> is disabled.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$file</strong> - The remote file's URL.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo fetch_remote_file('http://www.google.com/favicon.ico');</pre></dd>


<dt id="func_field_type" class="function"><strong>field_type</strong>(<em>string $table, string $field</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Outputs the field type of the specified <code>$field</code> within <code>$table</code>.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$table</strong> - The name of the table you are querying.<br />
<strong>$field</strong> - The name of the field you are querying.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo field_type('bookmarks', 'url');</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>varchar</pre></dd>


<dt id="func_file_put_contents" class="function"><strong>file_put_contents</strong>(<em>string $file <span class="optional">[, string $contents, int $flag]</span></em>); <a href="#">&uarr; top</a></dt>
<dd><p>Writes contents to specified file. Use the constant <code>FILE_APPEND</code> in the last attribute to append the contents to already existing files.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$file</strong> - File you want to put contents into to.<br />
<strong>$contents</strong> - Contents to be put into file.<br />
<strong>$flag</strong> - Default value is <em>null</em>. Alternate value is <code>FILE_APPEND</code>.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>file_put_contents('log.txt', 'This is a test', FILE_APPEND);</pre></dd>


<dt id="func_is_date" class="function"><strong>is_date</strong>(<em>string $value</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Validates a date. Returns boolean.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$value</strong> - String to validate.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo is_date('0000-00-00')?'Valid':'Invalid';</pre></dd>


<dt id="func_is_email" class="function"><strong>is_email</strong>(<em>string $value</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Validates an email. Returns boolean.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$value</strong> - String to validate.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo is_date('username@domain.com')?'Valid':'Invalid';</pre></dd>


<dt id="func_is_empty" class="function"><strong>is_empty</strong>(<em>string $value</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Validates empty variables. Returns boolean.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$value</strong> - String to validate.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo is_empty('')?'Empty':'Not Empty';</pre></dd>

<dt id="func_is_number" class="function"><strong>is_number</strong>(<em>string $value</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Validates a number. Returns boolean.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$value</strong> - String to validate.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo is_number(10.1)?'Valid':'Invalid';</pre></dd>


<dt id="func_is_simple" class="function"><strong>is_simple</strong>(<em>string $value</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Validates a simple string. Returns boolean.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$value</strong> - String to validate.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo is_simple('value')?'Valid':'Invalid';</pre></dd>


<dt id="func_is_simple_alpha" class="function"><strong>is_simple_alpha</strong>(<em>string $value</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Validates a simple alpha string. Returns boolean.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$value</strong> - String to validate.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo is_simple_alpha('just1value')?'Valid':'Invalid';</pre></dd>


<dt id="func_is_simple_number" class="function"><strong>is_simple_number</strong>(<em>string $value</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Validates a simple number. Returns boolean.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$value</strong> - String to validate.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo is_simple_number(10)?'Valid':'Invalid';</pre></dd>


<dt id="func_is_web_address" class="function"><strong>is_web_address</strong>(<em>string $value</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Validates a web address. Returns boolean.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$value</strong> - String to validate.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo is_web_address('http://overseercms.com/')?'Valid':'Invalid';</pre></dd>


<dt id="func_mysql_fetch_results" class="function"><strong>mysql_fetch_results</strong>(<em>string $query <span class="optional">[, array $results]</span></em>); <a href="#">&uarr; top</a></dt>
<dd><p>Returns the results of a MySQL query as an array.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$query</strong> - MySQL query.<br />
<strong>$results</strong> - Array to be returned with appended results.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre><a href="#func_print_array">print_array</a>(mysql_query_select('SELECT `id`, `url` FROM `test`.`bookmarks` LIMIT 5'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => Array
        (
            [id] => 1
            [url] => http://www.latherrinserepeat.org/
        )

    [1] => Array
        (
            [id] => 2
            [url] => http://www.boagworld.com/forum/
        )

    [2] => Array
        (
            [id] => 3
            [url] => http://www.dlanham.com/
        )

    [3] => Array
        (
            [id] => 4
            [url] => http://www.jemjabella.co.uk/
        )

    [4] => Array
        (
            [id] => 5
            [url] => http://www.stripegenerator.com/
        )

)</pre></dd>


<dt id="func_path_info" class="function"><strong>path_info</strong>(<em><span class="optional">[integer $offset]</span></em>); <a href="#">&uarr; top</a></dt>
<dd><p>Outputs the different parts of the <code>$_SERVER['PATH_INFO']</code> variable.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$offset</strong> - Key of the path_info variable to be returned.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo path_info(1); // URL: http://neo-geek.net/index.php/journal/<strong>1</strong></pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>1</pre></dd>


<dt id="func_primary_key" class="function"><strong>primary_key</strong>(<em>string $table</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Outputs the primary key of the specified <code>$table</code>.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$table</strong> - The name of the table you are querying.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo primary_key('bookmarks');</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>id</pre></dd>


<dt id="func_print_array" class="function"><strong>print_array</strong>(<em>array $array <span class="optional">[, array $array2, ..., array $array10]</span></em>); <a href="#">&uarr; top</a></dt>
<dd><p>Used to output multiple arrays surrounded by a <code>&lt;pre&gt;</code> tag.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
You can pass any number of arrays through this function.
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre><a href="#func_print_array">print_array</a>(array('value1', 'value2'), array('value3'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => value1
    [1] => value2
)
Array
(
    [0] => value3
)</pre></dd>


<dt id="func_sanitize_data" class="function"><strong>sanitize_data</strong>(array $data); <a href="#">&uarr; top</a></dt>
<dd><p>Cleans the data being passed for use in a MySQL query.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$data</strong> - Array to be processed.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>sanitize_data($_POST);</pre></dd>


<dt id="func_set_location" class="function"><strong>set_location</strong>(<em>string $url</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Changes the location of the page by use of the <code>header()</code> function in PHP. This function checks for previously sent headers and exists the script directly after setting the location.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$url</strong> - URL to set the header location to.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>set_location('/admin.php/dashboard');</pre></dd>


<dt id="func_timeago" class="function"><strong>timeago</strong>(<em>timestamp $timestamp</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Returns the time passed in "<em>n</em> day(s) ago."</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$timestamp</strong> - Timestamp you want to find the time passed from.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo timeago($timestamp);</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>3 days ago</pre></dd>


<dt id="func_url_query" class="function"><strong>url_query</strong>(<em>array $replacements, string $return</em>); <a href="#">&uarr; top</a></dt>
<dd><p>Allows for simple modification of the current addresses query variables.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$replacements</strong> - Array of replacement query variables.<br />
<strong>$return</strong> - Default value is <em>'string'</em>. Alternate value is <em>null</em> which returns the query variables as an array.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo url_query(array('db_limit'=>'50'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>?db_limit=50</pre></dd>


</dl>

<h1>Classes <a href="#">&uarr; top</a></h1>

<dl>

<dt id="class_database_resource" class="class">$<strong>Database</strong>-&gt;<strong>resource</strong> <a href="#">&uarr; top</a></dt>
<dd><p>Used to store the database connect resource from <a href="#class_db_connect"><code>$DB-&gt;Connect</code></a> or <a href="#class_db_resource"><code>$DB-&gt;resource</code></a>.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$Database-&gt;resource = <a href="#class_db_resource">$DB-&gt;resource</a>;</pre></dd>


<dt id="class_database_results" class="class">$<strong>Database</strong>-&gt;<strong>results</strong> <a href="#">&uarr; top</a></dt>
<dd><p>Automatically stores the results of <a href="#class_database_databaselist"><code>$Database-&gt;DatabaseList()</code></a>, <a href="#class_database_tablelist"><code>$Database-&gt;TableList()</code></a> and <a href="#class_database_table"><code>$Database-&gt;Table()</code></a>.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre><a href="#func_print_array">print_array</a>($Database-&gt;results);</pre></dd>


<dt id="class_database_databaselist" class="class">$<strong>Database</strong>-&gt;<strong>DatabaseList</strong>(); <a href="#">&uarr; top</a></dt>
<dd><p>Returns an array of available databases.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$DB-&gt;Connect('localhost', 'root', 'root', 'test');
<a href="#func_print_array">print_array</a>($Database-&gt;DatabaseList());</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => Array
        (
            [database] => information_schema
        )

    [1] => Array
        (
            [database] => mysql
        )

    [2] => Array
        (
            [database] => neogeek
        )

    [3] => Array
        (
            [database] => test
        )

)</pre></dd>


<dt id="class_database_tablelist" class="class">$<strong>Database</strong>-&gt;<strong>TableList</strong>(string $database); <a href="#">&uarr; top</a></dt>
<dd><p>Returns an array of tables in a certain database.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$database</strong> - Database you are connecting to.<br />
</p></dd>


<dd class="dh">Example:</dd>
<dd><pre>$DB-&gt;Connect('localhost', 'root', 'root', 'test');
<a href="#func_print_array">print_array</a>($Database-&gt;TableList('test'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => Array
        (
            [table] => bookmarks
        )

    [1] => Array
        (
            [table] => bug_reports
        )

)</pre></dd>


<dt id="class_database_table" class="class">$<strong>Database</strong>-&gt;<strong>Table</strong>(string $database, string $table, <span class="optional">[, string $fields, string $clause]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Returns an array of values in a table. Additional attributes allows for filtering of values.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$database</strong> - The name of the database you are connecting to.<br />
<strong>$table</strong> - The name of the table you are querying.<br />
<strong>$fields (optional)</strong> - The fields (comma separated) that you would like returned.<br />
<strong>$clause (optional)</strong> - A simple where clause allowing for narrowing of the results.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$DB-&gt;Connect('localhost', 'root', 'root', 'test');
<a href="#func_print_array">print_array</a>($Database-&gt;Table('test', 'bookmarks', 'id, url', 'WHERE `tag` = "blog"'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => Array
        (
            [id] => 1
            [url] => http://www.latherrinserepeat.org/
        )

    [1] => Array
        (
            [id] => 4
            [url] => http://www.jemjabella.co.uk/
        )

    [2] => Array
        (
            [id] => 36
            [url] => http://www.justinshattuck.com/
        )

    [3] => Array
        (
            [id] => 58
            [url] => http://chunkysoup.net/
        )

    [4] => Array
        (
            [id] => 60
            [url] => http://ejohn.org/
        )

)</pre></dd>


<dt id="class_database_process" class="class">$<strong>Database</strong>-&gt;<strong>Process</strong>(string $database, string $table, array $variables, <span class="optional">[, string $clause]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Saves information to a specific table with varaibles passed through <code>$variables</code> as an array.</p></dd>

<dd class="notice">The $variables attribute must contain the primary key of the table being modified if processing an update. If not, the values will be added as a new database record.</dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$database</strong> - The name of the database you are connecting to.<br />
<strong>$table</strong> - The name of the table you are querying.<br />
<strong>$variables</strong> - The values (including tables primary key) that you want to update.<br />
<strong>$clause (optional)</strong> - The conditional used when running an update query rather than an insert.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$DB-&gt;Connect('localhost', 'root', 'root', 'test');
$Database-&gt;Process('test', 'bookmarks', array('shared'=>'no'));</pre></dd>


<dt id="class_db_resource" class="class">$<strong>DB</strong>-&gt;<strong>resource</strong> <a href="#">&uarr; top</a></dt>
<dd><p>Used to store the database connect resource from <a href="#class_db_connect"><code>$DB-&gt;Connect</code></a>.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$DB-&gt;resource = <a href="#class_db_connect"><code>$DB-&gt;Connect</code></a>;</pre></dd>


<dt id="class_db_results" class="class">$<strong>DB</strong>-&gt;<strong>results</strong> <a href="#">&uarr; top</a></dt>
<dd><p>Automatically stores the results of <a href="#class_db_query"><code>$DB-&gt;Query()</code></a>.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre><a href="#func_print_array">print_array</a>($DB-&gt;results);</pre></dd>


<dt id="class_db_instances" class="class">$<strong>DB</strong>-&gt;<strong>instances</strong> <a href="#">&uarr; top</a></dt>
<dd><p>Stores the number of instances of both <a href="#class_db_connect"><code>$DB-&gt;Connect</code></a> and <a href="#class_db_query"><code>$DB-&gt;Query</code></a>.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo '$DB-&gt;Connect was called ' . $DB-&gt;instances['connect'] . ' time(s).&lt;br /&gt;';
echo '$DB-&gt;Query was called ' . $DB-&gt;instances['query'] . ' time(s).&lt;br /&gt;';</pre></dd>


<dt id="class_db_connect" class="class">$<strong>DB</strong>-&gt;<strong>Connect</strong>(string $server, string $username, string $password <span class="optional">[, string $database, boolean $cache]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Connects to a database with the specified information. Cache allows the connection to be stored for use with other functions such as <a href="#class_db_query"><code>$DB-&gt;Query()</code></a>.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$server</strong> - The name or IP address of the server you are connecting to.<br />
<strong>$database</strong> - The name of the database you are connecting to.<br />
<strong>$username</strong> - The username you are connecting with.<br />
<strong>$password</strong> - The password you are connecting with.<br />
<strong>$table</strong> - The name of the table you are querying. Default value is <em>null</em>.<br />
<strong>$cache</strong> - Boolean for storing the resource of this connect statement in the DB class. Default value is <em>true</em>. Can be accessed through the $DB-&gt;resouce variable.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$DB-&gt;Connect('localhost', 'root', 'root', 'test');</pre></dd>


<dt id="class_db_query" class="class">$<strong>DB</strong>-&gt;<strong>Query</strong>(string $query <span class="optional">[, resource $resource, string $return, boolean $cache]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Runs a query on the default (specified in <a href="#class_db_connect"><code>$DB-&gt;Connect</code></a>) or alternate database. Returns an array of results by default. Alternate returns are a basic boolean or the MySQL resource.</p></dd>

<dd class="notice">The $return variable is <em>array</em> by default. Alternative values are <em>resource</em> and <em>boolean</em>.</dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$query</strong> - MySQL query.<br />
<strong>$resource</strong> - Use a specific <a href="#class_db_connect"><code>$DB-&gt;Connect</code></a> resource or the default one stored in the DB class.<br />
<strong>$return</strong> - MySQL query.<br />
<strong>$cache</strong> - Boolean for storing the results of this query in the DB class. Default value is <em>true</em>. Can be accessed through the $DB-&gt;results variable.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$DB-&gt;Connect('localhost', 'root', 'root', 'test');
<a href="#func_print_array">print_array</a>($DB-&gt;Query('SELECT `id`, `url` FROM `test`.`bookmarks` LIMIT 5'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [0] => Array
        (
            [id] => 1
            [url] => http://www.latherrinserepeat.org/
        )

    [1] => Array
        (
            [id] => 2
            [url] => http://www.boagworld.com/forum/
        )

    [2] => Array
        (
            [id] => 3
            [url] => http://www.dlanham.com/
        )

    [3] => Array
        (
            [id] => 4
            [url] => http://www.jemjabella.co.uk/
        )

    [4] => Array
        (
            [id] => 5
            [url] => http://www.stripegenerator.com/
        )

)</pre></dd>


<dt id="class_db_close" class="class">$<strong>DB</strong>-&gt;<strong>Close</strong>(<span class="optional">[resource $resource]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Closed a MySQL connection created by <a href="#class_db_query"><code>$DB-&gt;Connect()</code></a> or a resource passed through function.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$resource</strong> - Use a specific <a href="#class_db_connect"><code>$DB-&gt;Connect</code></a> resource or the default one stored in the DB class.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$DB-&gt;Close();</pre></dd>


<dt id="class_gfx_resize" class="class">$<strong>GFX</strong>-&gt;<strong>Resize</strong>(string $image <span class="optional">[, integer $width, integer $height, string $output]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Resizes and crops JPG, GIF, and PNG image files on the fly using the built in PHP <a href="http://php.net/gd/">GD library</a>.</p></dd>

<dd class="notice">This function requires the <a href="http://php.net/gd/">GD library</a> in order to function correctly. Use the <a href="http://php.net/gdinfo/"><code>gdinfo()</code></a> function to see if the <a href="http://php.net/gd/">GD library</a> is installed and what version the server is running.</dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$width</strong> - The width of the new resized image. Does not need to be proportional to the <code>$height</code>.<br />
<strong>$height</strong> - The height of the new resized image. Does not need to be proportional to the <code>$width</code>.<br />
<strong>$output</strong> - The folder where the resized images will be stored. If this attribute contains a value, the function will return a URL to the resized image. If this attribute is left blank, the function will output the image. For this to work the function must be called on a page that doesn't output anything minus the result of this function.
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$GFX-&gt;Resize('images/test.png', 100, 100, 'cache/');</pre></dd>


<dt id="class_template_tools" class="class">$<strong>Template</strong>-&gt;<strong>tools</strong> <a href="#">&uarr; top</a></dt>
<dd><p>Appends HTML content into columns at the end of rows generated by <a href="#class_template_generate"><code>$Template-&gt;Generate</code></a>.</p></dd>

<dd class="notice">The below code must come before <a href="#class_template_generate"><code>$Template-&gt;Generate()</code></a> and should be cleared before calling <a href="#class_template_generate"><code>$Template-&gt;Generate()</code></a> again if the same tools are not needed.</dd>

<dd class="dh">Example:</dd>
<dd><pre>$Template-&gt;tools[] = array('View', '&lt;a href="?p=view&amp;id=%ID%"&gt;View&lt;/a&gt;');
$Template-&gt;tools[] = array('Edit', '&lt;a href="?p=edit&amp;id=%ID%"&gt;Edit&lt;/a&gt;');
$Template-&gt;tools[] = array('Delete', '&lt;a href="?p=del&amp;id=%ID%"&gt;Delete&lt;/a&gt;');</pre></dd>

<dd class="dh">Example:</dd>
<dd><pre>$Template-&gt;tools = array();</pre></dd>


<dt id="class_template_parse" class="class">$<strong>Template</strong>-&gt;<strong>Parse</strong>(string $template); <a href="#">&uarr; top</a></dt>
<dd><p>Parses template files/strings. Notice: <a href="#class_template_render"><code>$Template-&gt;Render()</code></a> automatically parses a template file passed through the first attribute.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$template</strong> - Template file or string to be parsed.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre><a href="#func_print_array">print_array</a>($Template-&gt;Parse('templates/custom/bookmarks.tpl'));</pre></dd>

<dd class="dh">Result:</dd>
<dd><pre>Array
(
    [header] =>

&lt;div&gt;


    [data] =>

&lt;div class=&quot;bookmark&quot;&gt;

&lt;h3&gt;&lt;a href=&quot;%URL%&quot;&gt;%DESCRIPTION%&lt;/a&gt;&lt;/h3&gt;
&lt;span class=&quot;dim&quot;&gt;to %TAG%&lt;/span&gt;

&lt;/div&gt;


    [footer] =>

&lt;/div&gt;


)</pre></dd>


<dt id="class_template_render" class="class">$<strong>Template</strong>-&gt;<strong>Render</strong>(string $template <span class="optional">[, array $data]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Renders a template based on data passed through the <code>$data</code> attribute.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$template</strong> - Template file or string to be parsed.<br />
<strong>$data</strong> - Array of data to replace template specific variables in the <code>$template</code>. Can also specify header and footer specific arrays for replacement.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$results = $DB-&gt;Query('SELECT `id`, `url` FROM `test`.`bookmarks`');
echo $Template-&gt;Render('templates/custom/bookmarks.tpl', $results);</pre></dd>

<dd class="dh">Example:</dd>
<dd><pre>$results['header'][0] = array('variable'=>'replacement');
$results['data'] = $DB-&gt;Query('SELECT `id`, `url` FROM `test`.`bookmarks`');
$results['footer'][0] = array('variable'=>'replacement');
echo $Template-&gt;Render('templates/custom/bookmarks.tpl', $results);</pre></dd>


<dt id="class_template_generate" class="class">$<strong>Template</strong>-&gt;<strong>Generate</strong>(array $data <span class="optional">[, boolean $sortable, boolean $render]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Similar to <a href="#class_template_render"><code>$Template-&gt;Render()</code></a>, but this function creates a tabulator template on the fly.</p></dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$data</strong> - Array of data to built template with and replace template specific variables in the <code>$template</code> if <code>$render</code> is <em>true</em>. <a href="#class_template_render">See <code>$Template-&gt;Render</code> for more info</a>.<br />
<strong>$sortable</strong> - Allow for manual sorting of table values.<br />
<strong>$render</strong> - Render generated template with data supplied.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$results = $DB-&gt;Query('SELECT `id`, `url` FROM `test`.`bookmarks`');
echo $Template-&gt;Generate($results, true, true);</pre></dd>

<dd class="notice">You can add tools to the end of each generated row by adding an array (below) to <a href="#class_template_tools"><code>$Template-&gt;tools</code></a> before calling <a href="#class_template_generate"><code>$Template-&gt;Generate()</code></a>.</dd>


<dt id="class_template_pagination" class="class">$<strong>Template</strong>-&gt;<strong>Pagination</strong>(<span class="optional">[number $total_rows, boolean $single_page_display]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Outputs pagination based on the number passed through <code>$total_rows</code>.</p></dd>

<dd class="notice">The math behind the pagination relies on both the <a href="#const_maxview"><code>maxview</code></a> constant and the number passed through <code>$total_rows</code>.</dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$total_rows</strong> - Number of total rows to be paginated with.<br />
<strong>$single_page_display</strong> - Boolean to show or hide pagination if there is only one page.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$results = $DB-&gt;Query('SELECT `id`, `url` FROM `test`.`bookmarks`');
echo $Template-&gt;Pagination(count($results), false);</pre></dd>


<dt id="class_template_form" class="class">$<strong>Template</strong>-&gt;<strong>Form</strong>(string $database, string $table <span class="optional">[, array $data, array $fields, boolean $autoformat]</span>); <a href="#">&uarr; top</a></dt>
<dd><p>Creates a form based on the table specified. Optional predefined data and fields can also be passed through the function.</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>echo $Template-&gt;Form('test', 'bookmarks');</pre></dd>

<dd class="notice">Elements in the form output can easily be replaced by regular expressions (see below). An example of usage would be replacing an input box with a select box.</dd>

<dd class="dh">Attributes:</dd>

<dd class="attr"><p>
<strong>$database</strong> - The name of the database you are connecting to.<br />
<strong>$table</strong> - The name of the table you are building a form with.<br />
<strong>$data</strong> - Predefined values for displayed fields.<br />
<strong>$fields</strong> - An array which can allow for only certain fields to display.<br />
<strong>$autoformat</strong> - Automatically formats the input fields to fit the field type in the database.<br />
</p></dd>

<dd class="dh">Example:</dd>
<dd><pre>$output = $Template-&gt;Form('test', 'bookmarks');
$output = preg_replace('/(&lt;label(.*)&gt;)Url(:&lt;\/label&gt;)/U',
'\1&lt;acronym title="Uniform Resource Locator"&gt;URL&lt;/acronym&gt;\3', $output);
echo $output;</pre></dd>

<dd class="dh">Example:</dd>
<dd><pre>$output = $Template-&gt;Form('test', 'bookmarks');
$output = preg_replace('/&lt;input name="active" (.*)\/&gt;/U', $form_active_select, $output);
echo $output;</pre></dd>

</dl>

</div>

<div id="footer">&copy; 2008 <a href="http://neo-geek.net/">Neo Geek</a>, Licenses: <a href="http://overseercms.com/framework/gpl.txt">GPL (source code)</a> and <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC Attribution-ShareAlike 3.0 (documentation)</a></div>

</div>

</body>
</html>